package com.itheima.demo;

import java.util.Scanner;

public class Java_08 {
    public static void main(String[] args) {
        //表头
        String pai = "品牌型号";
        String size = "尺寸";
        String price = "价格";
        String Zhi = "配置";
        String num = "库存数量";
        String sum_price = "总价";


        //定义一个扫描器对象
        Scanner sc = new Scanner(System.in);

        //华为手机入库
        String HuaWei = "华为";
        //输入华为手机的尺寸
        System.out.print("请输入华为手机尺寸：");
        double HuaWei_size = sc.nextDouble();
        //输入华为手机的价格
        System.out.print("请输入华为手机的价格：");
        double HuaWei_price = sc.nextDouble();
        //输入华为手机的配置
        System.out.print("请输入华为手机的配置：");
        String HuaWei_Zhi = sc.next();
        //输入华为手机的库存数量
        System.out.print("请输入华为手机的库存数量：");
        int HuaWei_num = sc.nextInt();
        //计算华为手机的总价
        double HuaWei_sum = HuaWei_price * HuaWei_num;

        //小米手机入库
        String XiaoMi = "小米";
        //输入小米手机的尺寸
        System.out.print("请输入小米手机的尺寸：");
        double XiaoMi_size = sc.nextDouble();
        //输入小米手机的价格
        System.out.print("请输入小米手机的价格：");
        double XiaoMi_price = sc.nextDouble();
        //输入小米手机的配置
        System.out.print("请输入小米手机的配置：");
        String XiaoMi_Zhi = sc.next();
        //输入小米手机的库存数量
        System.out.print("请输入小米手机的库存数量：");
        int XiaoMi_num = sc.nextInt();
        //计算小米手机的总价
        double XiaoMi_sum = XiaoMi_num * XiaoMi_price;

        // 打印表格
        System.out.println("------------------------库存清单---------------------------------------------");
        System.out.printf("%-15s\t%-10s\t%-10s\t%-15s\t%-10s\t%-15s\n", pai, size, price, Zhi, num, sum_price);
        System.out.println("----------------------------------------------------------------------------");
        System.out.printf("%-15s\t%-10.2f\t%-10.2f\t%-15s\t%-10d\t%-15.2f\n", HuaWei, HuaWei_size, HuaWei_price, HuaWei_Zhi, HuaWei_num,HuaWei_sum);
        System.out.printf("%-15s\t%-10.2f\t%-10.2f\t%-15s\t%-10d\t%-15.2f\n", XiaoMi, XiaoMi_size, XiaoMi_price, XiaoMi_Zhi, XiaoMi_num, XiaoMi_sum);
        System.out.println("----------------------------------------------------------------------------");

        // 打印总库存
        System.out.println("商品总库存为：" + (HuaWei_num + XiaoMi_num));
        // 打印商品总金额
        System.out.println("商品总金额为：" + (HuaWei_sum + XiaoMi_sum));
    }

//    private static double getInputDouble(Scanner sc, String prompt) {
//        System.out.println(prompt);
//        return sc.nextDouble();
//    }
//
//    private static int getInputInt(Scanner sc, String prompt) {
//        System.out.println(prompt);
//        return sc.nextInt();
//    }
//
//    private static String getInputString(Scanner sc, String prompt) {
//        System.out.println(prompt);
//        return sc.next();




    }

